package org.particlethink.response;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import org.particlethink.entry.BillStatus;
import org.particlethink.model.Bill;
import org.particlethink.model.Project;
import org.particlethink.model.ProjectUser;
import org.particlethink.model.Supplier;

import java.text.SimpleDateFormat;
import java.util.Date;

public class BillExportResponse {
    @ExcelProperty("对账单号")
    private String no;


    @ExcelProperty("对账周期")
    private String cycle;

    @ExcelProperty("管理层级")
    private String managementLevel; //管理层级
    @ExcelProperty("所属项目")
    private String projectName; //管理层级


    @ExcelProperty("合同买受方(收货)")
    private String projectName2; //管理层级


    @ExcelProperty("合同出售方(卖货)")
    private String supplierName; //管理层级
    @ExcelProperty("创建时间")
    private String createdAt;//最晚进场时间

    @ExcelProperty("创建人")
    private String creatorName;//创建人

    @ExcelProperty("状态")
    private String status;


    public BillExportResponse(Bill bill, Project project, Supplier supplier, ProjectUser creator) {
        this.no = bill.getNo();

        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy.MM.dd");

        this.cycle = (bill.getStartAt() == null || bill.getEndAt() == null) ? "" : simpleDateFormat2.format(bill.getStartAt()) + "-" + simpleDateFormat2.format(bill.getEndAt());
        this.managementLevel = project == null ? "" : project.getManagementLevel();
        this.projectName = project == null ? "" : project.getName();
        this.projectName2 = this.projectName;
        this.supplierName = supplier == null ? "" : supplier.getName();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd");

        this.createdAt = bill.getCreatedAt() == null ? "" : simpleDateFormat.format(bill.getCreatedAt());
        this.creatorName = creator == null ? "" : creator.getName();
        this.status = bill.getStatus().toString();
    }


    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getCycle() {
        return cycle;
    }

    public void setCycle(String cycle) {
        this.cycle = cycle;
    }

    public String getManagementLevel() {
        return managementLevel;
    }

    public void setManagementLevel(String managementLevel) {
        this.managementLevel = managementLevel;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getProjectName2() {
        return projectName2;
    }

    public void setProjectName2(String projectName2) {
        this.projectName2 = projectName2;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
